import React from 'react'
import { useHistory,useLocation } from 'react-router-dom';
import { useAuth } from './AuthProvider';

const Login = () => {
    const { setIsLogin } = useAuth();
    const history = useHistory();
    const location = useLocation();
    const login = () => {
        setIsLogin(true)
        localStorage.setItem('isLogin', true);
        history.replace(location.state || '/');
        // console.log(location)
    }
    return (
        <div>
            <h1>登录页面</h1>
            <button onClick={login}>登录</button>
        </div>
    )
}

export default Login
